<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>    
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<jsp:include page="../inc.jsp" />
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			$(function(){
				rebuilTable();
				
				$('#idcard').blur(function(){
					var idcard = $(this).val();
					if(idcard.length!=18){
						alert("请输入一个正确的身份证号码");
						return;
					}
					var sex = parseInt(idcard.substring(16,17));
					if(sex%2==1){
						sex = 1;
						$('#sexC').switchbutton('check');
					}else{
						sex = 2;
						$('#sexC').switchbutton('uncheck');
					}
					$('#sex').val(sex);
					var birthday = idcard.substring(6,10)
					+"-"+idcard.substring(10,12)
					+"-"+idcard.substring(12,14);
					$("#birthday").val(birthday);
					
				});
				$("#name").blur(function(){
					var name = $(this).val();
					var birth = $("#birthday").val();
					$.ajax({
						type:'get',
						url:'${ctx}/teacher/getLoginName?name='+name+'&birth='+birth,
						dataType:'json',
						success:function(r){
							var loginName = r.msg;
							$('#loginName').val(loginName);
						}
					});
				});
			});
			
			
		</script>
		<form id="dataForm">
			<input type="hidden" name="id" value="${tea.id }">
			<table cellspacing="0" cellpadding="0">
				<tr>
					<td align="right">证件号码:</td>
					<td>
						<input id="idcard" value="${tea.idcard }" 
						style="width:170px" name="idcard" class=""
							data-options="
							"
							/>
					</td>
				</tr>
				<tr>
					<td align="right">名称:</td>
					<td>
						<input id="name" name="name" value="${tea.name }" class="" 
							data-options="
								prompt:'职工姓名',
								validType:'chs'
							"/>
					</td>
				</tr>
				<tr>
					<td align="right">登录名:</td>
					<td>
						<input id="loginName" value="${tea.loginName }" style="width:170px" name="loginName" class=""
							data-options="
							"
							/>
					</td>
				</tr>
				<tr>
					<td align="right">性别:</td>
					<td>
						<input type="hidden" name="sex" id="sex" value="<c:choose><c:when test="${not empty tea.sex }">${tea.sex }</c:when><c:otherwise>2</c:otherwise></c:choose>"/>
						<input id="sexC" <c:if test="${tea.sex=='1' }">checked</c:if>
						 class="easyui-switchbutton" 
							data-options="onText:'男',offText:'女',
							onChange: function(checked){ 
								var s = $('#sex');
								s.val('2');
								if(checked){
									s.val('1');
								}
							}"/>
					</td>
				</tr>
				<tr>
					<td align="right">出生日期:</td>
					<td>
						<input id="birthday" name="birthday" value="<fmt:formatDate value="${tea.birthday }" pattern="yyyy-MM-dd"/>" class="" 
							data-options=""/>
					</td>
				</tr>
				<tr>
					<td align="right">所教课程:</td>
					<td >
						<select id="cc1" class="easyui-combobox" 
							name="learn" style="width:200px;">   
						    <option <c:if test="${tea.learn eq 'chinese' }">selected</c:if> value="chinese">语文</option>  
						    <option <c:if test="${tea.learn eq 'math' }">selected</c:if> value="math">数学</option>  
						    <option <c:if test="${tea.learn eq '英语' }">selected</c:if> value="英语">英语</option>  
						    <option <c:if test="${tea.learn eq '物理' }">selected</c:if> value="物理">物理</option>  
						    <option <c:if test="${tea.learn eq '化学' }">selected</c:if> value="化学">化学</option>  
						    <option <c:if test="${tea.learn eq '生物' }">selected</c:if> value="生物">生物</option>  
						</select>
					</td>
				</tr>
				<tr>
					<td align="right">职称:</td>
					<td >
						<select id="cc2" class="easyui-combobox" 
							name="job" style="width:200px;">   
						    <option <c:if test="${tea.job eq '班主任' }">selected</c:if> value="班主任">班主任</option>  
						    <option <c:if test="${tea.job eq '科任老师' }">selected</c:if> value="科任老师">科任老师</option>  
						    <option <c:if test="${tea.job eq '学科组长' }">selected</c:if> value="学科组长">学科组长</option>  
						    <option <c:if test="${tea.job eq '年级组长' }">selected</c:if> value="年级组长">年级组长</option>  
						    <option <c:if test="${tea.job eq '主任' }">selected</c:if> value="主任">主任</option>  
						    <option <c:if test="${tea.job eq '校长' }">selected</c:if> value="校长">校长</option>  
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<input type="" id=""password"" value="" style="width:170px" name="password" class=""
							data-options="
							"
							/>
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
